Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lou 59 posts 169 karma points
    Apr 25, 2013 @ 16:27
    Lou
    0

    Umbraco 6 Razor Missing Bracket Issue using a @{ within @helper

    I had a razor script which worked in 4.7.1 but claims there is a missing "}"  when I save or run the script in 6.0.3

    the missing "}" is the end of a @{ all my braces match and worked in 4.7.1

    if I don't have the @{ i just get Razor source code displayed this is due to using lots of divs in the razor code.

    I can't find any reference to the different interpretation of @{ in Umbraco 6 razor to 4.x razor.

    Does anyone know what the differences are?

  • Rich Green 2246 posts 4008 karma points
    Apr 25, 2013 @ 16:33
    Rich Green
    0

    Hey Lou,

    I know there was a breaking change to fit in with MVC, something about there having to be a space where there didn't need to be before.

    Rich

  • Lou 59 posts 169 karma points
    Apr 25, 2013 @ 16:52
    Lou
    0

    I am getting this error;

    Loading IMacroEngine script 0.004024 0.000038
    umbracoMacro Error Loading Razor Script (file: Videos) c:\inetpub\wwwroot\WebConnectB2CssV3\MacroScripts\Videos.cshtml(77): error CS1513: } expected    at System.Web.Compilation.AssemblyBuilder.Compile()
      at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
      at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
      at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
      at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
      at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
      at System.Web.WebPages.BuildManagerWrapper.CreateInstanceOfType[T](String virtualPath)
      at System.Web.WebPages.VirtualPathFactoryManager.CreateInstanceOfType[T](String virtualPath)
      at System.Web.WebPages.WebPageBase.CreateInstanceFromVirtualPath(String virtualPath, IVirtualPathFactory virtualPathFactory)
      at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
      at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
    0.093976 0.089951
    macro Error loading MacroEngine script (file: Videos.cshtml, Type: ''
    c:\inetpub\wwwroot\WebConnectB2CssV3\MacroScripts\Videos.cshtml(77): error CS1513: } expected
      at System.Web.Compilation.AssemblyBuilder.Compile()
      at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
      at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
      at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
      at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
      at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
      at System.Web.WebPages.BuildManagerWrapper.CreateInstanceOfType[T](String virtualPath)
      at System.Web.WebPages.VirtualPathFactoryManager.CreateInstanceOfType[T](String virtualPath)
      at System.Web.WebPages.WebPageBase.CreateInstanceFromVirtualPath(String virtualPath, IVirtualPathFactory virtualPathFactory)
      at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
      at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
      at umbraco.macro.loadMacroScript(MacroModel macro)
      at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
    0.094078 0.000102
    renderMacro Rendering started (macro: Footer Navigation, type: 1, cacheRate: 0)
  • Lou 59 posts 169 karma points
    Apr 25, 2013 @ 16:58
    Lou
    0

    I got rid of the @{  by duplicating divs inside a range of if conditions, but still have the problem, it it now appears to be a traverse function which is the difference between the ones that work and this one that doesn't work.

  • Lou 59 posts 169 karma points
    Apr 25, 2013 @ 17:07
    Lou
    0

    I have looked and there seems to be a lot of problems with missing "}" caused by DIV tags, but that still doesn't explain why it worked in 4.7.1 and not in umbraco 6. 

  • gary 385 posts 916 karma points
    Apr 25, 2013 @ 22:27
    gary
    0

    Hi Lou

    With MVC 4 comes razor V2, not present in 4.7, but implemented in later versions of Umbraco, there are very few changes, but if you have an @ inside an @{, other than a property call inside a div, it will break code- You do not have a missing }, what you have is an extra @, which doesn't have a } before it. Can't really explain easily, but that is my best shot.

    Post some code and we can have a look.

    Regards

    Gary

Please Sign in or register to post replies

Write your reply to:

Draft